package TestMethod;

import java.util.Scanner;

//带参无返回值方法
public class MethodDemo3 {
    //求两个float类型数据的最大值的方法
    public void max(float a,float b){
        if (a>b){
            System.out.println(a);
        }else if (a<b){
            System.out.println(b);
        }else {
            System.out.println("这两个数相等!");
        }

    }
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入要比较的两个浮点数:");
        float a=scanner.nextFloat();
        float b=scanner.nextFloat();
        MethodDemo3 methodDemo3=new MethodDemo3();
        System.out.println("比较结果是:");
        methodDemo3.max(a,b);
    }
}
